package cn.tedu.charging.order.timer;

import cn.tedu.charging.order.service.OrderService;
import com.xxl.job.core.context.XxlJobContext;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class OrderCheckTimer {
    @Autowired
    private OrderService orderService;
    /**
     * 检查订单在最长充电时间之后,是否真正结束
     * 结束: 1 fail 2 success的状态不是1
     * 调度中心在任务中 jobHandler名字 order-status-check
     */
    @XxlJob("order-status-check")
    public void orderStatusCheck(){
        //1.接收参数
        String billId= XxlJobContext.getXxlJobContext().getJobParam();
        //2.打印简单日志
        log.debug("订单检查任务开始执行,参数:{}",billId);
        orderService.orderStatusCheck(billId);
    }
}
